1. Field
The present invention relates generally to three-dimensional (3D) computer graphics and, more specifically, to scan line rasterizers in a 3D graphics pipeline.
2. Description
A typical 3D graphics pipeline for a raster display system includes a front-end subsystem and a back-end subsystem. The front-end subsystem includes a transform and light engine, and the back-end subsystem includes a rasterization engine.
The transform and light engine accepts 3D scene geometry (e.g., polygons) specified in three space coordinates, light source parameters, and camera parameters as input parameters. The transform and light engine applies the camera transformations to the 3D scene geometry to produce two-dimensional (2-D) screen space projected polygons (typically triangles). The transform and light engine also applies the light source parameters to produce vertex colors for each vertex of the screen space projected polygons. These colors are usually stored in red-green-blue (RGB) format, typically with five or eight bits per channel.
The rasterization engine draws polygons on a display screen. Rasterization converts transformed primitives into pixel values, and generally stores them in a frame buffer for subsequent display. Rasterization typically includes three sub-tasks: scan conversion, visible-surface determination, and shading. Rasterization, in principle, requires calculating each primitive's contribution to each pixel on the screen. The rasterization engine accepts a list of 2D polygons in screen space coordinates and a list of 2D vertices with vertex attributes as input parameters. Vertex attributes may include 2D position, Z depth, RGB vertex color (from lighting computation or user input), 2D texture coordinates, and optionally a per vertex alpha value. The alpha value is typically an eight-bit value stored with the RGB color values to form a 32-bit aligned data word for each pixel.
Scan conversion for a rasterization engine consists of two phases: triangle setup and scan line rasterization. Triangle setup computes starting points, ending points, and per pixel delta offsets for every scan line in a triangle of the scene. A per pixel delta offset needs to be computed for each attribute that is to be interpolated by the scan line rasterizer. Interpolated attributes may include x position, z depth, texture coordinates, fragment material color, and fragment alpha color. Scan line rasterizers render each scan line of a triangle. This requires applying the interpolated attributes to each pixel on the scan line and, based on specified rasterization parameters, performing the correct per pixel color computation to compute each pixel's color.
For best performance, a different scan line rasterizer should be optimally coded for each possible rasterization state. A rasterization state is a specific combination of interpolated attributes. There may be hundreds, or even thousands, of rasterization states depending on the number of supported attributes. A considerable amount of storage space would be needed to support such a variety of scan line rasterizers optimized for specific rasterization states. This is potentially wasteful since a given 3D application is unlikely to need more than a handful (e.g., 3–10) specific rasterizers (the degree of need is content dependent). In computing platforms having particular form factors (such as handheld computers for example), memory for storing rasterizers may be limited. Additionally, coding large numbers of rasterizers is burdensome, and some platforms may not have floating point computational capability.